﻿using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;

namespace ESSManageService.IServices
{
    /// <summary>
    /// 令牌与黑名单服务接口
    /// </summary>
    public interface ITokenBlacklistService
    {
        /// <summary>
        /// 添加令牌到黑名单
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        Task AddToBlacklistAsync(string token);
        /// <summary>
        /// 检查令牌是否在黑名单中
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        Task<bool> IsTokenBlacklistedAsync(string token);
        /// <summary>
        /// 解析 JWT 令牌并获取用户信息
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        ClaimsPrincipal GetPrincipalFromToken(string token);
        /// <summary>
        /// 颁发JWT字符串
        /// </summary>
        /// <param name="tokenModel"></param>
        /// <returns></returns>
        JwtSecurityToken IssueJwt(Claim[] claims, out DateTime localExpiry);
    }
}
